package ds_recommended.self_chuli

import org.apache.spark.sql.SparkSession

import java.util.Properties

object get_user_info {
  def main(args: Array[String]): Unit = {
    val spark=SparkSession.builder()
      .master("local[*]")
      .appName("得到用户的信息表")
      .getOrCreate()


    val connect = new Properties()
    connect.setProperty("user", "root")
    connect.setProperty("password", "123456")
    connect.setProperty("driver", "com.mysql.jdbc.Driver")

    spark.read.jdbc("jdbc:mysql://192.168.67.193:3307/ods?useSSL=false","order_info",connect)
      .select("user_id","user_name","province")
      .distinct()
      .write.mode("overwrite")
      .jdbc("jdbc:mysql://192.168.67.193:3307/ods?useSSL=false","user_info",connect)







    spark.close()
  }

}
